const fs = require('fs')
const path = require('path')

const { skeleton } = require('../index')
const url = 'http://localhost:8098/page/takeaway.html?enterprise_id=99225747&top_entity_id=99226429&wx_app_source=wx_normal&client=1#/'

const option = {
  device: 'iPhone 6',
  defer: 5000,
  excludes: ['.whole_background'],
  remove: [],
  hide:[],
  launch: {
    headless: false,
    executablePath: '/Applications/Google\ Chrome\ Canary.app/Contents/MacOS/Google\ Chrome\ Canary'
    // executablePath: path.join(__dirname, 'chrome-mac/Chromium.app/Contents/MacOS/Chromium')
  }
};

(async function() {

  const { html } = await skeleton(url, option)
  const pathName = path.join(__dirname, '/market.html')
  fs.writeFile(pathName, html, 'utf8', err => {
    if (err) console.log(err)
  })

})()
.catch(console.log.bind(console))

